package com.aidex.biz.utils.hengchang;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ClientTest {

    private static final Logger log = LoggerFactory.getLogger(ClientTest.class);
    /**
     * 请求参数
     */
    static String inputStr = "{\n" +
            "\t\"name\":\"某某\",\n" +
            "\t\"phoneNum\":\"18888888888\",\n" +
            "\t\"province\":\"河北省\",\n" +
            "\t\"city\":\"石家庄市\",\n" +
            "\t\"applyTime\":\"2022-04-14 10:39:59\",\n" +
            "\t\"pushTime\":\"2022-04-14 11:39:59\",\n" +
            "\t\"licenseNo\":\"京A88888\",\n" +
            "\t\"brand\":\"北京奔驰\",\n" +
            "\t\"carType\":\"2021款E300L 运动豪华型\",\n" +
            "\t\"chassisNo\":\"WDBGP57B6PB127810\",\n" +
            "\t\"firstLicenseTime\":\"2022-04-14\",\n" +
            "\t\"thisLicenseTime\":\"2022-04-14\",\n" +
            "\t\"mileage\":5000,\n" +
            "\t\"IsBelong\":2,\n" +
            "\t\"isLoan\":1,\n" +
            "\t\"loanStatus\":1,\n" +
            "\t\"mortgageStatus\":1,\n" +
            "\t\"realName\":\"某某\",\n" +
            "\t\"cardType\":1,\n" +
            "\t\"cardNum\":\"1100000000000 \",\n" +
            "\t\"bankName\":\"北京银行\",\n" +
            "\t\"bankNum\":\"5490986782343\",\n" +
            "\t\"residenceAddress\":\"北京市东城区……街道……\",\n" +
            "\t\"idCardStartTime\":\"2018-08-08\",\n" +
            "\t\"idCardEndTime\":\"2028-08-08\",\n" +
            "\t\"applyAmount\":50000,\n" +
            "\t\"applyPeriods\":24,\n" +
            "\t\"clueSource\":1\n" +
            "}\n";
    /**
     * 公钥：具体的在接口信息中提供
     *
     * @param args
     */
    static String pubKey = "feojgjklwjefjoisdwe/fkgpoopdfigerlksldfkgkrekodfg....";

    /**
     * demo
     * @param args
     * @throws Exception
     */
    public static void main(String[] args) throws Exception{
        log.info("ClientTest：我是第三方，我开始执行");
        // 生成DES随机密钥
        String key = CryptDESUtil.createDesKey();
        // 用DES算法加密request报文
        String requestData = CryptDESUtil.desEntrypt(key, inputStr);
        // 通过RSA的publicKey对DES随机钥匙加密
        String requestKey = ClientRSAUtil.rsaEncryptByPubKey(pubKey,key);
        log.info("ClientTest：调用接收方，请求参数 requestKey = 【{}】， requestData = 【{}】", requestKey, requestData);
        /**
         *  调用接收方：将 requestKey 和 requestData 发送给接收方
         */
        // String resp = ServerTest.handleRequest(requestKey,requestData);
        // String respInfo = CryptDESUtil.desDecrypt(key,resp);
       // log.info("ClientTest：调用接收方，响应结果是 respInfo = 【{}】， ", respInfo);
    }
}
